Key activity detection system and method thereof

ABSTRACT

A key activity detection method, applied in an electronic device having at least a first key and a digital I/O pin, includes: switching the digital I/O pin to a first operation mode, so that a voltage of the digital I/O pin is decreased to a ground voltage; switching the digital I/O pin to a second operation mode, so that the voltage of the digital I/O pin is increased; measuring a first charge period of the voltage of the digital I/O pin; counting a first appearance times of the first charge period; judging whether the first key is stably activated according to the first appearance times of the first charge period.

This application claims the benefit of Taiwan application Serial No.99103394, filed Feb. 4, 2010, the subject matter of which isincorporated herein by reference.

BACKGROUND OF THE DISCLOSURE

1. Technical Field

The disclosure relates in general to a key activity detection system anda method thereof.

2. Background

Currently, there are many ways for detecting whether multiple keys arepressed/released. Let the computer keyboard be taken for example. Acomputer keyboard has many independent driving lines and sensing lines.Which computer key(s) is/are pressed/released can be identified bysequentially scanning the driving lines. However, this method isapplicable to the computer keyboard with large-sized printed circuitboard.

Let the human machine interface be taken for example. For example, theDVD drive or the DVD player equipped with push buttons detects whetherthe button (such as disc ejection button) is pressed, so that the DVDdrive or the DVD player performs corresponding mechanical operation(such as to eject the disc). Currently, to detect whether a key/buttonis pressed/released in a human machine interface system can beimplemented by an analog-to-digital converter (ADC). Since the ADC is ananalog circuit, once the chip manufacturer or the manufacturing processchanges, the adaptation of the ADC needs to be checked again. In somecases, a re-designed new ADC may be needed, which raises a big waste oftime and resources. Further, the ADC needs to cooperate with analogpins, which can only support fixed functions and cannot be adapted tofit the needs of design change.

Therefore, it is a prominent task for the industries to provide a keyactivity detection system which resolves the weakness of the currentlyavailable technology.

BRIEF SUMMARY OF THE DISCLOSURE

The disclosure is directed to a key activity detection system and amethod thereof. Whether the key(s) is/are stably activated(pressed/released) is judged according to the duration of a chargeperiod, the appearance time(s) of the charge period, and the change ofthe charge period.

According to a first exemplary embodiment of the present disclosure, akey activity detection method applied in an electronic device isdisclosed. The electronic device has at least a first key and a digitalI/O pin. The method includes: switching the digital I/O pin to a firstoperation mode, so that a voltage of the digital I/O pin is decreased toa ground voltage; switching the digital I/O pin to a second operationmode, so that the voltage of the digital I/O pin is increased; measuringa first charge period of the voltage of the digital I/O pin; counting afirst appearance time(s) of the first charge period; and judging whetherthe first key is stably activated according to the first appearancetime(s) of the first charge period.

According to a second exemplary embodiment of the present disclosure, akey activity detection system is disclosed. The system includes: atleast a first key; a first capacitor coupled to the first key; a digitalI/O pin coupled to the first key; and a controller coupled to thedigital I/O pin and the first key. During mode switching, a voltage ofthe digital I/O pin is increased/decreased; and the controller measuresa first charge period of the voltage of the digital I/O pin. If a firstappearance time(s) of the first charge period exceeds a threshold, thecontroller determines that the first key is stably activated.

It is to be understood that both the foregoing general description andthe following detailed description are exemplary and explanatory onlyand are not restrictive of the disclosed embodiments, as claimed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a key activity detection system according to an embodimentof the disclosure;

FIG. 2 shows a timing diagram of according to the embodiment of thedisclosure;

FIG. 3 shows a flowchart of detecting stable key activity according tothe embodiment of the disclosure;

FIG. 4 shows a process of detecting and ignoring unstable key activityaccording to the embodiment of the disclosure;

FIG. 5 shows a process of detecting stable multiple-key activityaccording to the embodiment of the disclosure; and

FIG. 6 shows a flowchart of detecting multiple key activities accordingto the embodiment of the disclosure.

DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENT OF THE PRESENT DISCLOSURE

In an embodiment of the disclosure, when a stable key activity isdetected, a corresponding operation is performed in response to thestable key activity. To the contrary, if the key activity is detected asa transient state (that is, an unstable key activity), then the keyactivity is neglected.

FIG. 1 shows a key activity detection system according to the embodimentof the disclosure. The key activity detection system 100 is disposed inan electronic device, such as but is not limited to a DVD drive or a DVDplayer. As indicated in FIG. 1, the key activity detection system 100includes an input/output (I/O) pin 110, a controller 120, a resistor R,a plurality of keys K0˜K4 and a plurality of capacitors C0˜C4. Thecapacitances of capacitors C0˜C4 are different and known.

The I/O pin 110 is a digital pin. The I/O pin 110 has two operationmodes: the input mode and the output mode. Operation of the I/O pin 110is switched in response to a mode control signal MD_CTL outputted fromthe controller 120. In the following disclosure, if the mode controlsignal MD_CTL is logic high, the I/O pin 110 is in the output mode andset to GND. To the contrary, if the mode control signal MD_CTL is logiclow, the I/O pin 110 is in the input mode. However, anyone who isskilled in the technology of the disclosure will understand that thedisclosure is not limited thereto. Besides, the logic high period of themode control signal MD_CTL are long enough for the output voltage VO tobe decreased to a ground voltage GND.

In the present embodiment of the disclosure, in case that the I/O pin110 is in the input mode, if one or multiple corresponding keys is/arealready pressed, then electrical conduction is formed between thecorresponding one or multiple capacitors and a node point P, and thecorresponding capacitor(s) will be charged by an operating voltage VCC.On the other hand, in case that the I/O pin 110 is in the output modeand set to GND, if one or multiple corresponding key is/are alreadypressed, then the corresponding one or multiple capacitor will be in adischarge state, and the output voltage VO will be decreased. Theresistor R is serially connected between the operating voltage VCC andthe node point P. The keys K0˜K4 are connected between the node point Pand the capacitors C0˜C4 respectively.

FIG. 2 shows a timing diagram of according to the embodiment of thedisclosure. In FIG. 2, the signal K0 indicates whether the key K0 ispressed. For example, that the signal K0 is logic low implies that thekey K0 is in a release state. To the contrary, that the signal K0 islogic high implies that the key K0 is in a press state.

The signal TC indicates the period (also known as “charge period”)required for the output voltage VO to be increased to a level higherthan the threshold voltage Vth from the ground voltage GND after the I/Opin 110 is switched to the input mode from the output mode. Therespective capacitances of the capacitors C0˜C4 are different and theresistance of the resistor R is known, so the respective charging rateof the capacitors C0˜C4 is also known. When one (or more) key is stablypressed, the charge period for its corresponding capacitor to be chargedto a level higher than the threshold voltage Vth from the ground voltageGND is also known. In the present embodiment of the disclosure, alook-up table is built in the controller 120. The look-up table keeps arecord of all possible charge periods and all possible key activitiescorresponding to all possible charge periods. The possible chargeperiods include but are not limited to the charge period detected whenone single key is pressed, possible charge periods detected when aplurality of keys (such as 2 or 3 or more keys) is pressed, and so on.After the controller 120 detects the charge period required for theoutput voltage VO to be charged to a level higher than the thresholdvoltage Vth, the controller 120 will perform comparison to identifywhich capacitor(s) is in the charge state so as to identify which key(s)is pressed. To the contrary, if the measured charge period does notbelong to any of the possible combinations and/or the appearance time(s)of the charge period is/are not enough, then the charge period isregarded as being caused by unintentional key pressing by the user andis neglected by the controller 120.

The signal N indicates the repetition times of the charge period TC. Forexample, assume the key K0 is stably pressed, basically a single chargeperiod TC0 will be detected each time the I/O pin 110 is switched to theinput mode from the output mode. By accumulating the appearance time(s)of the detected charge period TC0, the accumulative value N will beobtained. If the duration of the charge period TC changes (for example,due to press of other key, release of the key K0, or unstable keyactivity), then the accumulative value N will be reset as 0.

The signal IN reflects the output voltage VO. In greater details, whenthe output voltage VO is lower than the threshold voltage Vth, thesignal IN is logic 0. To the contrary, when the output voltage VO ishigher than the threshold voltage Vth, the signal IN is logic 1. Thatis, the signal IN can be regarded as a digital version of the outputvoltage VO. The signal IN and the output voltage VO are inputted to thecontroller 120.

Referring to FIG. 2. Suppose the user did not press any key activitybefore timing T11. At timing T11, the user presses the key K0.Meanwhile, the voltage of the non-ground end of the capacitor C0 is theground voltage because the capacitor C0 is completely discharged.Therefore, at timing T11, at the moment the user presses the key K0, theoutput voltage VO will immediately become the ground voltage GND becausethe voltage of the non-ground end of the capacitor C0 is still theground voltage. After that, the capacitor C0 is charged and the outputvoltage VO is increased.

At timing T12, since the I/O pin 110 is switched to the output mode, theoutput voltage VO is decreased to the ground voltage GND. Then, attiming T13, since the I/O pin 110 is switched back to the input mode andthe key K0 is still being pressed, the capacitor C0 is charged and theoutput voltage VO is increased. At timing T14, the output voltage VO isincreased higher than the threshold voltage Vth.

After the I/O pin 110 is switched back to the input mode from the outputmode, the charge period required for the output voltage VO to beincreased from the ground voltage to a level higher than the thresholdvoltage Vth is measured. In the following periods, since the key isstably pressed, multiple periods TC0 will be stably nearly detected. Theappearance time(s) of the charge period TC0 is/are counted andaccumulated, and the change in the accumulative value N is as follows:0→1→2→3→4.

At timing T15, the key K0 is released, and the signal TC will be set as0. Likewise, the accumulative value N will be set to 0 as well. If theaccumulative value N is larger than or equal to the threshold Nth, thenthe controller 120 detects a stable key activity (i.e. FIG. 2 shows thekey is pressed); and according to the detected charge period, thecontroller 120 identifies which key or keys is pressed from the look-uptable, and the electronic device performs corresponding operationaccording to the detection result from the controller 120.

Since the duration that the user stably presses the key is not veryshort (for example, at least around 0.2 seconds), as long as thefrequency of the mode control signal MD_CTL is high enough, theaccumulative value N will be larger than the threshold within the periodthat the user stably presses the key.

FIG. 3 shows a flowchart of detecting stable key activity according tothe embodiment of the disclosure. At step 310, the I/O pin 110 isswitched to the output mode to discharge the capacitor so that theoutput voltage VO is decreased to the ground voltage GND.

At step 320, the I/O pin 110 is switched to the input mode. At step 330,after the mode is switched, the charge period is measured, and theappearance time(s) (the accumulative value) of the charge period is/arecounted.

After that, at step 340, whether the accumulative value N is larger thanor equal to the threshold Nth is judged. If yes, then the methodproceeds to step 350, otherwise, the method returns to step 310. Ingreater details, in step 340, if the accumulative value is smaller thanthe threshold, then the controller 120 will neglect the detected chargeperiod.

Afterwards, at step 350, the controller 120 determines that a stable keyactivity is detected. At step 360, the controller 120 will judge whichkey(s) is/are stably activated. In greater details, in step 360, whenthe accumulative value N is larger than or equal to threshold Nth, thecontroller 120 identifies that the measured charge period corresponds toone of all possible key activity combination from the look-up table andfurther judges which key(s) is/are stably activated. Let FIG. 2 be takenfor example. Since the accumulative value N=4 is larger than thethreshold (assume that the threshold is as 2 or 3, and can be adjustedif necessary), the controller 120 looks up the table and determines thatthe charge period TC0 corresponds to the capacitor C0 (that is, the keyK0 is pressed). In the present embodiment, the electronic deviceperforms corresponding operation in response to the judgment made by thecontroller 120. For example, let the key K0 be the disc ejection key.Then, in response to the judgment made by the controller 120, theoptical disc drive (the electronic device) will eject the disc.

Despite the FIG. 1 is exemplified by a plurality of keys, the presentembodiment of the disclosure can also be applied to the electronicdevice with only one single key.

How to detect unstable key activity is disclosed below. Referring toFIG. 4, a process of detecting and ignoring unstable key activityaccording to the embodiment of the disclosure is shown. Suppose the userunstably presses the key K0 at timing T41. Meanwhile, the I/O pin 110 isswitched to the input mode from the output mode. Since the capacitor C0is unstably charged, the charge period is accidentally extended (denotedas “TC?” in FIG. 4). The unstable key activity makes the accumulativevalue N become 1 (denoted as the designation 41 in FIG. 4). However,since the accumulative value N is smaller than the threshold, theunstable key activity caused by the user at timing 41 will be neglectedby the controller. After that, the user stably presses the key K0 asindicated in FIG. 2, and the details are not repeated here.

As indicated in FIG. 4, even during mode switching, the accumulativevalue will not become larger than or equal to the threshold if the userunstably (unintentionally) presses the key. Thus, the user's unstablekey activity will be neglected lest the electronic device might incurerroneous operation. This is because the user may simply press the keyunintentionally.

The process of detection when the user unstably presses multiple keys isdisclosed below. Referring to FIG. 5, a process of detecting stablemultiple-key activity according to the embodiment of the disclosure isshown. As indicated in FIG. 5, suppose no key is pressed before timingT51 and the user stably presses the key K0 at timing T51. The stable keyactivity will make the controller detect 3 charge period TC0, and makethe accumulative value N become larger than or equal to the threshold(as indicated in the designation 51 of FIG. 5, the signal N isaccumulated to 3 from 1).

After that, at timing T52, the user stably presses the key K1. Supposethe capacitor C0 is charged at the same time. Since the key K1 ispressed, the capacitor C1 will be charged, and the charge period willchange accordingly. Since the charge period at timing T52 is not matchedin the in-built look-up table, this is denoted as “TC?” in FIG. 5.

Then, since the user stably presses the keys K0 and K1, the detectedcharge period will change to a charge period “TC0+TC1” from chargeperiod TC?. The charge period TC0+TC1 is matched in the look-up table.With the keys K0 and K1 being stably pressed, the controller will detect3 charge periods TC0+TC1, and the accumulative value N becomes largerthan or equal to the threshold (as indicated in the designation 52 ofFIG. 5, the signal N is accumulated from 1 to 3). Since the accumulativevalue N is larger than or equal to the threshold, the controller looksup the table, and determines that the charge period TC0+TC1 is a chargeperiod corresponding to the capacitors C0 and C1 and identifies that theuser presses the key K0 and K1.

Then, at timing T53, the user releases the key K1. Suppose the capacitorC0 is charged at the same time, and the charge period changesaccordingly. Since the charge period corresponding to timing T53 is notmatched in the in-built look-up table, the timing is denoted as TC? inFIG. 5.

Since the user still stably presses the key K0, 3 charge periods TC0will be detected. Next, at timing T54, the user releases the key K1.

As is disclosed above, multiple key activities can be detected in thepresent embodiment of the disclosure. For example, when the user stablypresses multiple keys, the present embodiment of the disclosure candetect and identify which keys are pressed. Likewise, when the userreleases a particular key, the present embodiment of the disclosure candetect and identify which key(s) is released by detecting the change ofthe charge period.

FIG. 6 shows a flowchart of detecting multiple key activities accordingto the embodiment of the disclosure. As indicated in FIG. 6, in step610, the controller judges whether the old stable charge period Old_S_TCis equal to the new stable charge period New_S_TC. In greater details,in step 610, the so-called “stable charge period” refers to the chargeperiod whose appearance time(s) is larger than or equal to thethreshold. Let FIG. 5 be taken for example, the charge period TC0 whichoccurs for 3 times (the appearance times are larger than or equal to thethreshold) is regarded as the old stable charge period Old_S_TC, and thecharge period TC0+TC1 which occurs afterwards (the appearance times, 3,are larger than or equal to the threshold) is regarded as the new stablecharge period New_S_TC. If the result of the judgment of step 610 isyes, then the method terminates, otherwise, the method proceeds to step620.

In step 620, a charge period difference ΔT between the old stable chargeperiod Old_S_TC and the new stable charge period New_S_TC is calculated.ΔT can be expressed as: ΔT=|Old_S_TC-New_S_TC|, that is, ΔT is theabsolute value of the difference between the old stable charge periodOld_S_TC and the new stable charge period New_S_TC.

In step 630, the controller judges which key(s) is stably activated bylooking up the table according to the charge period difference ΔT. Ingreater details, the in-built look-up table of the controller furtherrecords the correspondences between the charge period difference ΔT andall possible key activities combinations. For example, let FIG. 5 betaken for example. The difference between the charge period TC0 (the oldstable charge period Old_S_TC) and the charge period TC0+TC1 (the newstable charge period New_S_TC) is TC1 (ΔT=TC1), and after looking up thetable, the controller still determines that the keys K0 and K1 areactivated.

In step 640, the duration of the old stable charge period Old_S_TC andthe duration of the new stable charge period New_S_TC are compared. Ifthe new stable charge period New_S_TC is shorter than the old stablecharge period Old_S_TC, then the method proceeds to step 650. To thecontrary, if the new stable charge period New_S_TC is longer than theold stable charge period Old_S_TC, then the method proceeds to step 660.

In step 650, the controller judges which key(s) is/are releasedaccording to the charge period difference ΔT and the criterion that thenew stable charge period New_S_TC is shorter than the old stable chargeperiod Old_S_TC.

In step 660, the controller judges which key(s) is/are releasedaccording to the charge period difference ΔT and the criterion that andthe new stable charge period New_S_TC is longer than the old stablecharge period Old_S_TC.

Let FIG. 5 be taken for example. Given that the old stable charge periodOld_S_TC is the charge period TC0 and the new stable charge periodNew_S_TC is the charge period TC0+TC1, the controller will determinethat the key K1 is pressed, wherein the controller already determines inadvance that the key K0 is pressed. After that, given that the oldstable charge period Old_S_TC is the charge period TC0+TC1 and the newstable charge period New_S_TC is the charge period TC0, the controllerwill determine that the key K1 is released and that the key K0 is stillpressed. As for the charge period TC? between the stable charge periodTC0 and the stable charge period TC0+TC1, the appearance time (1)thereof is lower than the threshold, as indicated in FIG. 3, the chargeperiod TC? will not be regarded as a stable charge period, and thecontroller will not perform any corresponding operations.

In step 670, the new stable charge period New_S_TC is set as the oldstable charge period Old_S_TC (Old_S_TC=New_S_TC).

Despite the above embodiment is exemplified by the key(s), anyone who isskilled in the technology of the disclosure will understand that otherembodiments of the disclosure are applicable to the electronic deviceequipped with push buttons or switches.

The key activity detection system and method disclosed in the aboveembodiments of the disclosure have technical features exemplified below:(1) Operation mode of the I/O pin is alternately switched between theinput mode and the output mode instead of being fixed in the input mode.(2) The I/O pin is alternately switched between the input mode and theoutput mode, so that the output voltage is alternately increased anddecreased instead of being fixed at a sable voltage. (3) Unlike theconventional ADC which samples according to multiple levels, thedisclosure performs sampling by the binary method. (4) Unlike theconventional ADC which judges whether a key is activated according tovoltage change, the disclosure judges whether the key is stablyactivated (pressed/released) according to the duration of a chargeperiod, the appearance time(s) of the charge period, and the change ofthe charge period (that is, the difference and the relationship betweenthe old stable charge period and the new stable charge period).

It will be appreciated by those skilled in the art that changes could bemade to the disclosed embodiments described above without departing fromthe broad inventive concept thereof. It is understood, therefore, thatthe disclosed embodiments are not limited to the particular examplesdisclosed, but is intended to cover modifications within the spirit andscope of the disclosed embodiments as defined by the claims that follow.

1. A key activity detection method applied in an electronic devicehaving at least a first key and a digital input/output (I/O) pin,comprising: switching the digital I/O pin to a first operation mode, sothat a voltage of the digital I/O pin is decreased to a ground voltage;switching the digital I/O pin to a second operation mode, so that thevoltage of the digital I/O pin is increased; measuring a first chargeperiod of the voltage of the digital I/O pin; counting a firstappearance times of the first charge period; and judging whether thefirst key is stably activated according to the first appearance times ofthe first charge period.
 2. The method according to claim 1, wherein,during the first charge period, the voltage of the digital I/O pin isincreased to a level exceeding a voltage threshold from the groundvoltage.
 3. The method according to claim 1, wherein, the step ofcounting the first appearance times of the first charge periodcomprises: accumulating the first appearance times if a duration of thefirst charge period does not change; and resetting the first appearancetimes if the duration of the first charge period changes.
 4. The methodaccording to claim 1, further comprising: judging the first key isstably activated if the first appearance times of the first chargeperiod are larger than or equal to a count threshold.
 5. The methodaccording to claim 1, wherein, the electronic device further comprises asecond key.
 6. The method according to claim 5, further comprising:judging the first key or the second key is stably activated according toa duration of the first charge period if the first appearance times ofthe first charge period are larger than or equal to a count threshold.7. The method according to claim 5, further comprising: counting adifference between the first charge period and the second charge periodif the first charge period is not equal to a second charge period,wherein, the first appearance times of the first charge period and asecond appearance times of the second charge period are both larger thanor equal to the count threshold; judging the first key and/or the secondkey is stably activated according to the difference between the firstcharge period and the second charge period; judging the first key and/orthe second key is released if the first charge period is longer than thesecond charge period; and judging the first key and/or the second key ispressed if the first charge period is shorter than the second chargeperiod.
 8. A key activity detection system, comprising: at least a firstkey; a first capacitor coupled to the first key; a digital I/O pincoupled to the first key; and a controller coupled to the digital I/Opin and the first key; wherein during mode switching, a voltage of thedigital I/O pin is increased/decreased, the controller measures a firstcharge period of the voltage of the digital I/O pin, and determines thatthe first key is stably activated if a first appearance times of thefirst charge period exceeds a count threshold.
 9. The key activitydetection system according to claim 8, wherein, under the control of thecontroller, the digital I/O pin is switched to a first operation mode,so that the voltage of the digital I/O pin is decreased to a groundvoltage; under the control of the controller, the digital I/O pin isswitched to a second operation mode; the controller measures that thevoltage of the digital I/O pin is increased to a level exceeding avoltage threshold from the ground voltage during the first chargeperiod; the controller counts the first appearance times of the firstcharge period.
 10. The key activity detection system according to claim9, wherein, the controller accumulates the first appearance times if aduration of the first charge period does not change; and the controllerresets the first appearance times if the duration of the first chargeperiod changes.
 11. The key activity detection system according to claim10, wherein, the electronic device further comprises a second key. 12.The key activity detection system according to claim 11, wherein, thecontroller judges the first key or the second key is stably activatedaccording to a duration of the first charge period if the firstappearance times of the first charge period is larger than or equal to acount threshold.
 13. The key activity detection system according toclaim 11, wherein, if the first charge period is not equal to a secondcharge period, the controller calculates a difference between the firstcharge period and the second charge period wherein, the first appearancetimes of the first charge period and a second appearance times of thesecond charge period are both larger than or equal to the countthreshold; the controller judges the first key and/or the second key isstably activated according to the difference between the first chargeperiod and the second charge period; the controller determines that thefirst key and/or the second key is released if the first charge periodis longer than the second charge period; and the controller determinesthat the first key and/or the second key is pressed if the first chargeperiod is shorter than the second charge period.